 package GUI;


import java.util.logging.Level;
import java.util.logging.Logger;
import java.sql.*;



public class Version
{
   public  static Connection con ;
   public  static Statement st ;
   public  static ResultSet rs;
   public  static String url;
   public  static String user;
   public  static String password;
   public  static Statement s;

    public static void connection(String[] args)
    {
       System.out.println("Setting up connetion...");
       con = null;
       st = null;
       rs = null;

       url = "jdbc:mysql://mmoo.no-ip.info:3306/ahuset";
       user = "PaRo";
       password = "patriklool";


        try
        {

            con = DriverManager.getConnection(url, user, password);
            st = con.createStatement();
            rs = st.executeQuery("SELECT VERSION()");

            if (rs.next())
            {
                System.out.println(rs.getString(1));
            }
            System.out.println("Connetion established");
        }
        catch (Exception ex)
        {
            Logger lgr = Logger.getLogger(SqlHandler.class.getName());
            lgr.log(Level.SEVERE, ex.getMessage(), ex);

        }
        finally
        {
//            try {
//                if (rs != null)
//                {
//                    rs.close();
//                }
//                if (st != null)
//                {
//                    st.close();
//                }
//                if (con != null)
//                {
//                    con.close();
//                }

//            } catch (Exception ex) {
//                Logger lgr = Logger.getLogger(SqlHandler.class.getName());
//                lgr.log(Level.WARNING, ex.getMessage(), ex);
//            }
        }

    }
}
